#!/usr/bin/python3
import argparse
from genericpath import isdir
import os
import shutil 
parser = argparse.ArgumentParser()
parser.add_argument("dir")
args = parser.parse_args()
# print(args.dir)
root_dir = args.dir
rm_dir_list = ['O.Common', 'O.linux-x86_64']
def rm_useless_dir(root_path):
    for dir in os.listdir(root_path):
        path = os.path.join(root_path, dir)
        if dir in rm_dir_list:
            shutil.rmtree(path)
            print(f'remove [{dir}] sucess')
        else:
            if os.path.isdir(path):
                rm_useless_dir(path)
                # print(f'{path} is directory')
            else:
                # print(f'{path} is file')
                pass
rm_useless_dir(root_dir)
